home *** CD-ROM | disk | FTP | other *** search
/ Aminet 51 / Aminet 51 (2002)(GTI - Schatztruhe)[!][Oct 2002].iso / Aminet / util / misc / ReportPlus.lha / reportplus / source / f2.c < prev    next >
Encoding:
C/C++ Source or Header  |  2002-08-23  |  41.7 KB  |  1,268 lines

  1. #include <exec/types.h>
  2. #include <exec/memory.h>
  3. #include <clib/exec_protos.h>
  4. #include <intuition/intuition.h>
  5. #include <clib/intuition_protos.h>
  6. #include <libraries/gadtools.h>
  7. #include <clib/gadtools_protos.h>
  8. #include <graphics/gfx.h>
  9. #include <clib/graphics_protos.h>
  10.  
  11. #include <clib/alib_protos.h>
  12. #include <ctype.h>
  13. #include <stdlib.h>
  14. #include <string.h>
  15. #include "rp.h"
  16.  
  17. #define ALL_REACTION_CLASSES
  18. #define ALL_REACTION_MACROS
  19. #include <reaction/reaction.h>
  20. #include <gadgets/texteditor.h>
  21. #include <clib/texteditor_protos.h>
  22. #include <pragmas/texteditor_pragmas.h>
  23.  
  24. #define MAINTYPES   15
  25. #define CATEGORIES 341
  26. struct
  27. {   ULONG start, end;
  28. } offsets[MAINTYPES + 1] =
  29. {   16,  26, // biz
  30.     27,  47, // comm
  31.     48,  73, // demo
  32.     74,  90, // dev
  33.     91,  97, // disk
  34.     98, 105, // docs
  35.    106, 120, // game
  36.    121, 132, // gfx
  37.    133, 135, // hard
  38.    136, 140, // info
  39.    141, 150, // misc
  40.    151, 261, // mods
  41.    262, 265, // mus
  42.    266, 307, // pix
  43.    308, 318, // text
  44.    319, 341  // util
  45. };
  46.  
  47. AGLOBAL struct AminetStruct aminet;
  48.  
  49. // from rp.c
  50. IMPORT ABOOL                fillwindows;
  51. IMPORT SBYTE                page;
  52. IMPORT TEXT                 IOBuffer[LONGESTFIELD + 1],
  53.                             aslresult[PATHNAMEFIELD + 1],
  54.                             string[LONGESTFIELD + 1];
  55. IMPORT ULONG                offset;
  56. IMPORT struct SharedStruct  shared;
  57. IMPORT struct Window*       MainWindowPtr;
  58. IMPORT struct Library*      TextEditorBase;
  59. IMPORT Object*              WinObject[FUNCTIONS + 1]; // note that WindowObject is a reserved macro
  60. IMPORT struct Menu*         MenuPtr;
  61. IMPORT struct Screen*       ScreenPtr;
  62. IMPORT struct TextAttr      Topaz8;
  63.  
  64. MODULE void updateaminetgadgets(void);
  65. MODULE void readaminetgadgets(void);
  66. MODULE void updatesubtype(void);
  67.  
  68. MODULE ABOOL          MainTypeNodes     = FALSE,
  69.                       SubTypeNodes      = FALSE;
  70. MODULE struct List    MainTypeList,
  71.                       SubTypeList,
  72.                       EmptySubTypeList;
  73.  
  74. MODULE struct Gadget *aminet_gadgets[GIDS_2 + 1];
  75.  
  76. MODULE struct
  77. {   STRPTR name;
  78.     STRPTR desc;
  79. } category[CATEGORIES + 1] =
  80. { // all (0)
  81. "biz",   "Business software",
  82. "comm",  "Communications",
  83. "demo",  "Gfx and sound demos",
  84. "dev",   "Development software",
  85. "disk",  "Disk/Harddisk tools",
  86. "docs",  "Text documents",
  87. "game",  "Games",
  88. "gfx",   "Graphics",
  89. "hard",  "Hardware",
  90. "info",  "General FTP information",
  91. "misc",  "Miscellaneous",
  92. "mods",  "Music modules",
  93. "mus",   "Musical software",
  94. "pix",   "Pictures",
  95. "text",  "Text related",
  96. "util",  "Utilities",
  97. // biz (16)
  98. "cloan", "Cloanto software & support",
  99. "dbase", "Data base software",
  100. "demo",  "Demo versions of commercial software",
  101. "dkg",   "DarkAge software & support",
  102. "dopus", "Directory Opus files",
  103. "haage", "Haage & Partner software & support",
  104. "misc",  "Misc business type soft",
  105. "patch", "Commercial software patches",
  106. "p5",    "phase5 software & support",
  107. "swood", "Softwood products",
  108. "titan", "Titan Computer software",
  109. // comm (27)
  110. "ambos", "AmBoS (BBS) related",
  111. "amiex", "Ami-Express BBS related",
  112. "bbs",   "BBS programs",
  113. "cnet",  "CNET BBS related",
  114. "dlg",   "DLG BBS related",
  115. "fido",  "FIDO software",
  116. "irc",   "Internet Relay Chat software",
  117. "mail",  "Mailing soft",
  118. "maxs",  "MaxsBBS related",
  119. "mebbs", "MEBBSNet BBS related",
  120. "misc",  "Misc communications",
  121. "mmgr",  "MailManager related",
  122. "net",   "Networking",
  123. "news",  "Newsreaders",
  124. "tcp",   "AmiTCP networking",
  125. "term",  "Terminal programs",
  126. "thor",  "Thor mail/news system",
  127. "ums",   "Universal Message System",
  128. "uucp",  "UUCP software",
  129. "www",   "World Wide Web software",
  130. "xeno",  "Xenolink BBS related",
  131. // demo (48)
  132. "40k",   "40K intros",
  133. "aga",   "Demos requiring AGA chipset",
  134. "bse",   "Belgian Scene Event files",
  135. "disk",  "Demos on diskettes",
  136. "ecs",   "Demos for the ECS chip set",
  137. "euro",  "Euro demos in file form",
  138. "file",  "Single file demos",
  139. "funet", "From the Funet collection",
  140. "intro", "Intros",
  141. "mag",   "Demo coder magazines",
  142. "mega",  "Euro demos requiring floppies",
  143. "slide", "Image oriented demos",
  144. "sound", "Sound oriented demos",
  145. "sp96",  "Saturne Party 96 demos",
  146. "ta95",  "Demos from The Assembly 95",
  147. "ta96",  "Demos from The Assembly 96",
  148. "ta97",  "Demos from The Assembly 97",
  149. "tg93",  "The Gathering 1993 demos",
  150. "tg95",  "The Gathering 1995 demos",
  151. "tg96",  "The Gathering 1996 demos",
  152. "tg97",  "The Gathering 1997 demos",
  153. "tp92",  "Demos from The Party 92",
  154. "tp94",  "Demos from The Party 94",
  155. "tp95",  "Demos from The Party 95",
  156. "tp96",  "Demos from The Party 96",
  157. "track", "Trackmos",
  158. // dev (74)
  159. "amos",  "AMOS BASIC compiler",
  160. "asm",   "Assembly language related",
  161. "basic", "BASIC language related",
  162. "c",     "C language related",
  163. "cross", "Cross development",
  164. "debug", "Debugging software",
  165. "e",     "E language related",
  166. "gcc",   "GNU C compiler",
  167. "gg",    "Geek Gadgets GNU software",
  168. "gui",   "GUI builders",
  169. "lang",  "Various languages",
  170. "m2",    "Modula-2 related",
  171. "misc",  "Misc development software",
  172. "moni",  "Monitors/disassemblers",
  173. "mui",   "MagicUserInterface related",
  174. "obero", "Oberon related software",
  175. "src",   "Tutorial sources",
  176. // disk (92)
  177. "bakup", "Backup software",
  178. "cache", "Disk caching",
  179. "cdrom", "CD-ROM related software",
  180. "misc",  "Various disk related tools",
  181. "moni",  "Disk monitors",
  182. "optim", "Disk optimizers",
  183. "salv",  "Disk recovery software",
  184. // docs (99)
  185. "anno",  "Announcement documents",
  186. "etext", "Project Gutenberg books",
  187. "help",  "Help on various issues",
  188. "hyper", "Hypertext documents",
  189. "lists", "Lists and tables",
  190. "mags",  "Magazines",
  191. "misc",  "Various documents",
  192. "rview", "Amiga product reviews",
  193. // game (107)
  194. "2play", "2 and more player games",
  195. "actio", "Action games",
  196. "board", "Board games",
  197. "data",  "Data files for games",
  198. "demo",  "Demos of commercial games",
  199. "gag",   "Gag programs",
  200. "hint",  "Game hint documents",
  201. "jump",  "Jump-n-run games",
  202. "misc",  "Miscellaneous games",
  203. "patch", "Patches for games",
  204. "role",  "Role, adventure games",
  205. "shoot", "Shoot-em-up games",
  206. "text",  "Text based adventures",
  207. "think", "Mind games",
  208. "wb",    "Workbench games",
  209. // gfx  (122)
  210. "3d",    "3D graphics software",
  211. "3dobj", "3D objects",
  212. "aga",   "AGA chip set software",
  213. "board", "Custom gfx board software",
  214. "conv",  "Gfx conversion tools",
  215. "edit",  "Paint programs",
  216. "fract", "Fractals and Mandelbrots",
  217. "ifx",   "ImageFX related files",
  218. "misc",  "Misc graphics software",
  219. "pbm",   "Pbm+ gfx conversion",
  220. "show",  "Image/anim displayers",
  221. "x11",   "Amiga X-Windows",
  222. // hard (134)
  223. "drivr", "Drivers for hardware",
  224. "hack",  "Selfmade hardware",
  225. "misc",  "Misc hardware related files",
  226. // info (137)
  227. "adt",   "Machine readable filelists",
  228. "index", "Various Aminet index files",
  229. "sites", "Info on other FTP sites",
  230. "start", "Beginner information",
  231. "stats", "Statistics about this site",
  232. // misc (142)
  233. "amag",  "German Amiga Mag PD",
  234. "antiq", "Nostalgic stuff",
  235. "edu",   "Educational software",
  236. "emu",   "Emulations",
  237. "imdb",  "Internet Movie Database",
  238. "kids",  "Children's software",
  239. "math",  "Mathematics",
  240. "misc",  "Uncategorizable",
  241. "sci",   "Scientific software",
  242. "unix",  "Amiga related UNIX software",
  243. // mods (152)
  244. "32bit", "MP3s by 32bit choonz",
  245. "4mat",  "Mods by 4mat",
  246. "8voic", "8-voiced songs",
  247. "airon", "Mods by Airon",
  248. "alpma", "Mods by Johan Alpmar",
  249. "atmos", "Atmospheric music",
  250. "aweso", "Mods by Dr Awesome",
  251. "bhead", "Mods by Basehead",
  252. "bladr", "Mods by Black Dragon",
  253. "blk",   "Mods by Black Shadow",
  254. "blkha", "Mods by Blakkhar",
  255. "boing", "Boing collection",
  256. "boray", "Mods by Boray",
  257. "casef", "Mods by Case and Filippetto",
  258. "cato",  "Mods by Don Cato",
  259. "cels",  "Mods by Celsius",
  260. "chart", "Module hits",
  261. "chip",  "Mods without samples",
  262. "chrom", "Mods by Chromag",
  263. "chryl", "Mods by Chrylian",
  264. "clawz", "Mods by Clawz",
  265. "cloud", "Mods by Cloud",
  266. "crash", "Mods by Crash Noise Division",
  267. "crn",   "Mods by Corrosion",
  268. "ctp",   "Mods by Counterpoint",
  269. "cutc",  "Mods by Cutcreator",
  270. "darde", "Mods by Fredius Darde",
  271. "dean",  "Mods by Dean",
  272. "delor", "Mods by Delorean",
  273. "demo",  "Demo style music",
  274. "dizzy", "Mods by Dizzy",
  275. "dlusn", "Mods by D.Lusion",
  276. "doh",   "Mods by Doh",
  277. "dremr", "Mods by Dreamer",
  278. "dsx",   "Mods by DSX",
  279. "elbie", "Mods by Elbie",
  280. "emax",  "Mods by Emax",
  281. "ephnx", "Mods by Euphonix",
  282. "evrim", "Mods by Evrimsson",
  283. "exprt", "Mods by Expert",
  284. "facet", "Mods by Facet",
  285. "fby",   "Mods by Fabio Barzagli",
  286. "fermx", "Mods by Fermix",
  287. "fox2",  "Mods by TheFoxII",
  288. "funet", "Funet collection",
  289. "funk",  "Funky/jazzy mods",
  290. "hardc", "Hardcore techno",
  291. "hje",   "Mods by H.J. Ehrentraud",
  292. "huezo", "Mods by Huezo",
  293. "house", "House modules",
  294. "hw",    "Mods by Hillware",
  295. "inst",  "Instruments for modules",
  296. "instr", "Instrumental music",
  297. "jogei", "Mods by Jogeir Liljedahl",
  298. "jorma", "Mods by Da Jormas (techno)",
  299. "jungl", "Jungle/Breakbeat mods",
  300. "k4k",   "Mods by k4k",
  301. "kaa",   "Mods by Redd Kaa",
  302. "lead",  "Mods by Lead",
  303. "mark",  "Mods by Mark Salud",
  304. "maxym", "Mods by Maxym",
  305. "med",   "MED modules",
  306. "melod", "Melodic modules",
  307. "melom", "Mods by MeloManiac",
  308. "midi",  "Music in MIDI format",
  309. "misc",  "Miscellaneous songs",
  310. "mnc",   "Mods by Meanace",
  311. "mpg",   "Music in MPEG audio format",
  312. "mryo",  "Mods by Mr. Yo",
  313. "mvp",   "Mods by MoPlayaz",
  314. "ncase", "Mods by Nutcase",
  315. "neuro", "Neurodancer's modules",
  316. "nork",  "Mods by Nork",
  317. "ooze",  "Mods by Ooze",
  318. "otis",  "Mods by Otis",
  319. "panik", "Mods by Panik",
  320. "pdy",   "Mods by Prodigy",
  321. "pete",  "Mods by Pirate Pete",
  322. "piano", "Piano mods",
  323. "pop",   "Pop music",
  324. "pro",   "Protracker songs",
  325. "przk",  "Mods by Parsec",
  326. "punn",  "Mods by Punnik",
  327. "purg",  "Mods by Purgatory",
  328. "racoo", "Mods by Racoon", // new for 5.02
  329. "rated", "Misc rated modules",
  330. "rebel", "Mods by Rebel Riffs",
  331. "rock",  "Rock'n'Roll",
  332. "roz",   "Mods by Roz",
  333. "s3m",   "Multichannel s3m mods",
  334. "sbc",   "Modules by Substance",
  335. "sets",  "Module collections",
  336. "sidew", "Mods by Sidewinder",
  337. "slc",   "Mods by Slice",
  338. "slow",  "Slow, melodic modules",
  339. "smg",   "Modes by esemgy",
  340. "smpl",  "Sound samples",
  341. "sonor", "Mods by Sonority",
  342. "spark", "Mods by P.D. Spark",
  343. "stame", "Mods by Stamen",
  344. "synth", "Synthesizer modules",
  345. "techn", "Techno music",
  346. "toady", "Mods by Olivier Gonneau",
  347. "tranc", "Trance techno mods",
  348. "tp96",  "Mods from The Party 1996",
  349. "uns",   "Mods by UnIsOn",
  350. "voice", "Music with voices",
  351. "voy",   "Mods by Voyager",
  352. "wmr",   "Mods reviewed by WMR",
  353. "xceed", "Mods by X-Ceed (ex Snoopy)",
  354. "xm",    "Multichannel xm mods",
  355. // mus (259)
  356. "edit",  "Composing software",
  357. "midi",  "MIDI software",
  358. "misc",  "Miscellaneous",
  359. "play",  "Sound players",
  360. // pix (263)
  361. "3dani", "3D animations",
  362. "addic", "Pictures by 3DAddict",
  363. "anim",  "Animations",
  364. "art",   "Hand drawn imagery",
  365. "astro", "Astronomy pictures",
  366. "back",  "Workbench backdrop pictures",
  367. "bill",  "Bill Graham traces",
  368. "boot",  "Boot pictures",
  369. "clip",  "Clip art",
  370. "eps",   "Structured EPS images",
  371. "eric",  "Eric Schwartz anims",
  372. "fauna", "Animals",
  373. "fract", "Fractals",
  374. "gicon", "GlowIcons",
  375. "glenn", "Traces by Glenn J. Schworak",
  376. "guard", "Guardians traces",
  377. "heiko", "Traces by Heiko Popp",
  378. "henz",  "Traces by Patrick Henz", // new for 5.02
  379. "icon",  "Workbench icons",
  380. "illu",  "Illustrations",
  381. "imagi", "Imagine traces",
  382. "irc",   "The people on IRC",
  383. "jake",  "The Ragtime Gallery",
  384. "jason", "Jason Brown illustration",
  385. "map",   "Images of maps",
  386. "mark",  "Traces by Markus Kuhnen",
  387. "misc",  "Miscellaneous images",
  388. "mpg",   "MPEG animations",
  389. "mwb",   "MagicWB icons",
  390. "nevil", "Pics by Neville Rolle",
  391. "nicon", "NewIcons",
  392. "park",  "Maps of US national parks",
  393. "real3", "Real3D traces",
  394. "sport", "Sports pictures",
  395. "textu", "Textures",
  396. "tp96",  "Pics from The Party 1996",
  397. "trace", "Raytraced pictures",
  398. "unrl",  "Animations by Unreal",
  399. "vehic", "Vehicle images",
  400. "views", "Scenery, countries",
  401. "wb",    "Example WB screens",
  402. "wfm",   "Artwork of William F. Maddock",
  403. // text (303)
  404. "bfont", "Bitmap font collection",
  405. "dtp",   "Desk top publishing",
  406. "edit",  "Editors",
  407. "font",  "Fonts of all formats and related too", // ..."ls"
  408. "hyper", "Hypertext tools",
  409. "ifont", "Intellifont collection",
  410. "misc",  "Misc text software",
  411. "pfont", "Postscript font collection",
  412. "print", "Printing tools",
  413. "show",  "Text displayers",
  414. "tex",   "TeX formatting package",
  415. // util (314)
  416. "app",   "AppIcons, AppWindows",
  417. "arc",   "Archivers",
  418. "batch", "Script software",
  419. "blank", "Screen blankers",
  420. "boot",  "Startup sequence software",
  421. "cdity", "Commodity type software",
  422. "cli",   "Command line interface",
  423. "conv",  "File conversion",
  424. "crypt", "Encryption tools",
  425. "dir",   "Directory utilities",
  426. "dtype", "Datatypes for OS 3.x",
  427. "gnu",   "GNU utilities",
  428. "libs",  "Libraries",
  429. "misc",  "Miscellaneous",
  430. "moni",  "System monitors",
  431. "mouse", "Mouse accelerators",
  432. "pack",  "Packers",
  433. "rexx",  "ARexx tools",
  434. "shell", "Shells",
  435. "sys",   "Common file replacements",
  436. "time",  "Clocks and timing",
  437. "virus", "Virus checkers",
  438. "wb",    "Workbench utilities"
  439. };
  440.  
  441. AGLOBAL void aminet1(void)
  442. {   struct Hook Hook2Struct;
  443.  
  444.     if ((!(aminet.uploader[0])) && readin("S:Report.sender"))
  445.     {   /* # Refer: <last>,<first> (<company> ,phone <phone>)<LF>
  446.            # Path: <email><LF>
  447.            # ReferID: <developer><LF> */
  448.  
  449.         offset = 0;
  450.         parse("# Refer: ");
  451.         parse(",");
  452.         parse(" (");
  453.         parse(" ,phone ");
  454.         parse(")\n# Path: ");
  455.         parse("\n# ReferID: ");
  456.         strcpy(aminet.uploader, string);
  457.     }
  458.  
  459.     InitHook(&Hook2Struct, Hook2Func, NULL);
  460.  
  461.     /* Create the window object. */
  462.     lockscreen();
  463.  
  464. if (!(WinObject[2] =
  465. NewObject
  466. (   WINDOW_GetClass(),                    NULL,
  467.     WA_PubScreen,                         ScreenPtr,
  468.     WA_ScreenTitle,                       "Report+",
  469.     WA_Title,                             "Report+: Aminet Readme Editor",
  470.     WA_Activate,                          TRUE,
  471.     WA_DepthGadget,                       TRUE,
  472.     WA_DragBar,                           TRUE,
  473.     WA_CloseGadget,                       TRUE,
  474.     WA_SizeGadget,                        TRUE,
  475.     WA_IDCMP,                             IDCMP_RAWKEY,
  476.     WINDOW_IDCMPHook,                     &Hook2Struct,
  477.     WINDOW_IDCMPHookBits,                 IDCMP_RAWKEY,
  478.     WINDOW_MenuStrip,                     MenuPtr,
  479.     WINDOW_Position,                      WPOS_CENTERSCREEN,
  480.     WINDOW_ParentGroup,                   aminet_gadgets[GID_2_LY1] =
  481.     NewObject
  482.     (   LAYOUT_GetClass(),                NULL,
  483.         LAYOUT_Orientation,               LAYOUT_ORIENT_VERT,
  484.         LAYOUT_SpaceOuter,                TRUE,
  485.         LAYOUT_DeferLayout,               TRUE,
  486.         LAYOUT_AddChild,
  487.         NewObject
  488.         (   LAYOUT_GetClass(),            NULL,
  489.             LAYOUT_Orientation,           LAYOUT_ORIENT_HORIZ,
  490.             LAYOUT_SpaceOuter,            TRUE,
  491.             LAYOUT_DeferLayout,           TRUE,
  492.             LAYOUT_BevelStyle,            BVS_NONE,
  493.             LAYOUT_AddChild,
  494.             NewObject
  495.             (   LAYOUT_GetClass(),        NULL,
  496.                 LAYOUT_Orientation,       LAYOUT_ORIENT_VERT,
  497.                 LAYOUT_SpaceOuter,        TRUE,
  498.                 LAYOUT_VertAlignment,     LALIGN_CENTER,
  499.                 LAYOUT_BevelStyle,        BVS_NONE,
  500.                 LAYOUT_AddChild,
  501.                 NewObject
  502.                 (   LAYOUT_GetClass(),    NULL,
  503.                     LAYOUT_Orientation,   LAYOUT_ORIENT_HORIZ,
  504.                     LAYOUT_SpaceOuter,    TRUE,
  505.                     LAYOUT_HorizAlignment,LALIGN_RIGHT,
  506.                     LAYOUT_BevelStyle,    BVS_NONE,
  507.                     LAYOUT_AddImage,
  508.                     NewObject
  509.                     (   LABEL_GetClass(),     NULL,
  510.                         LABEL_Text,           "_Short:",
  511.                         LABEL_Justification,  LJ_RIGHT,
  512.                     TAG_END),
  513.                 TAG_END),
  514.                 LAYOUT_AddChild,
  515.                 NewObject
  516.                 (   LAYOUT_GetClass(),        NULL,
  517.                     LAYOUT_Orientation,       LAYOUT_ORIENT_HORIZ,
  518.                     LAYOUT_SpaceOuter,        TRUE,
  519.                     LAYOUT_HorizAlignment,    LALIGN_RIGHT,
  520.                     LAYOUT_BevelStyle,        BVS_NONE,
  521.                     LAYOUT_AddImage,
  522.                     NewObject
  523.                     (   LABEL_GetClass(),     NULL,
  524.                         LABEL_Text,           "_Uploader:",
  525.                         LABEL_Justification,  LJ_RIGHT,
  526.                     TAG_END),
  527.                 TAG_END),
  528.                 LAYOUT_AddChild,
  529.                 NewObject
  530.                 (   LAYOUT_GetClass(),        NULL,
  531.                     LAYOUT_Orientation,       LAYOUT_ORIENT_HORIZ,
  532.                     LAYOUT_SpaceOuter,        TRUE,
  533.                     LAYOUT_HorizAlignment,    LALIGN_RIGHT,
  534.                     LAYOUT_BevelStyle,        BVS_NONE,
  535.                     LAYOUT_AddImage,
  536.                     NewObject
  537.                     (   LABEL_GetClass(),     NULL,
  538.                         LABEL_Text,           "_Author:",
  539.                         LABEL_Justification,  LJ_RIGHT,
  540.                     TAG_END),
  541.                 TAG_END),
  542.                 LAYOUT_AddChild,
  543.                 NewObject
  544.                 (   LAYOUT_GetClass(),        NULL,
  545.                     LAYOUT_Orientation,       LAYOUT_ORIENT_HORIZ,
  546.                     LAYOUT_SpaceOuter,        TRUE,
  547.                     LAYOUT_HorizAlignment,    LALIGN_RIGHT,
  548.                     LAYOUT_BevelStyle,        BVS_NONE,
  549.                     LAYOUT_AddImage,
  550.                     NewObject
  551.                     (   LABEL_GetClass(),     NULL,
  552.                         LABEL_Text,           "_Replaces:",
  553.                         LABEL_Justification,  LJ_RIGHT,
  554.                     TAG_END),
  555.                 TAG_END),
  556.                 LAYOUT_AddChild,
  557.                 NewObject
  558.                 (   LAYOUT_GetClass(),        NULL,
  559.                     LAYOUT_Orientation,       LAYOUT_ORIENT_HORIZ,
  560.                     LAYOUT_SpaceOuter,        TRUE,
  561.                     LAYOUT_HorizAlignment,    LALIGN_RIGHT,
  562.                     LAYOUT_BevelStyle,        BVS_NONE,
  563.                     LAYOUT_AddImage,
  564.                     NewObject
  565.                     (   LABEL_GetClass(),     NULL,
  566.                         LABEL_Text,           "R_equires:",
  567.                         LABEL_Justification,  LJ_RIGHT,
  568.                     TAG_END),
  569.                 TAG_END),
  570.                 LAYOUT_AddChild,
  571.                 NewObject
  572.                 (   LAYOUT_GetClass(),        NULL,
  573.                     LAYOUT_Orientation,       LAYOUT_ORIENT_HORIZ,
  574.                     LAYOUT_SpaceOuter,        TRUE,
  575.                     LAYOUT_HorizAlignment,    LALIGN_RIGHT,
  576.                     LAYOUT_BevelStyle,        BVS_NONE,
  577.                     LAYOUT_AddImage,
  578.                     NewObject
  579.                     (   LABEL_GetClass(),     NULL,
  580.                         LABEL_Text,           "_Version:",
  581.                         LABEL_Justification,  LJ_RIGHT,
  582.                     TAG_END),
  583.                 TAG_END),
  584.                 LAYOUT_AddChild,
  585.                 NewObject
  586.                 (   LAYOUT_GetClass(),        NULL,
  587.                     LAYOUT_Orientation,       LAYOUT_ORIENT_HORIZ,
  588.                     LAYOUT_SpaceOuter,        TRUE,
  589.                     LAYOUT_HorizAlignment,    LALIGN_RIGHT,
  590.                     LAYOUT_BevelStyle,        BVS_NONE,
  591.                     LAYOUT_AddImage,
  592.                     NewObject
  593.                     (   LABEL_GetClass(),     NULL,
  594.                         LABEL_Text,           "_Distribution:",
  595.                         LABEL_Justification,  LJ_RIGHT,
  596.                     TAG_END),
  597.                 TAG_END),
  598.             TAG_END),
  599.             CHILD_WeightedWidth,      0,
  600.             LAYOUT_AddChild,
  601.             NewObject
  602.             (   LAYOUT_GetClass(),    NULL,
  603.                 LAYOUT_Orientation,   LAYOUT_ORIENT_VERT,
  604.                 LAYOUT_SpaceOuter,    TRUE,
  605.                 LAYOUT_VertAlignment, LALIGN_CENTER,
  606.                 LAYOUT_HorizAlignment,LALIGN_CENTER,
  607.                 LAYOUT_BevelStyle,    BVS_NONE,
  608.                 LAYOUT_AddChild,      aminet_gadgets[GID_2_ST1] =
  609.                 NewObject
  610.                 (   STRING_GetClass(),    NULL,
  611.                     GA_ID,                GID_2_ST1,
  612.                     GA_TabCycle,          TRUE,
  613.                     STRINGA_TextVal,      aminet.amishort,
  614.                     STRINGA_MinVisible,   20,
  615.                     STRINGA_MaxChars,     40,
  616.                 TAG_END),
  617.                 LAYOUT_AddChild,          aminet_gadgets[GID_2_ST2] =
  618.                 NewObject
  619.                 (   STRING_GetClass(),    NULL,
  620.                     GA_ID,                GID_2_ST2,
  621.                     GA_TabCycle,          TRUE,
  622.                     STRINGA_TextVal,      aminet.uploader,
  623.                     STRINGA_MinVisible,   20,
  624.                     STRINGA_MaxChars,     40,
  625.                 TAG_END),
  626.                 LAYOUT_AddChild,          aminet_gadgets[GID_2_ST3] =
  627.                 NewObject
  628.                 (   STRING_GetClass(),    NULL,
  629.                     GA_ID,                GID_2_ST3,
  630.                     GA_TabCycle,          TRUE,
  631.                     STRINGA_TextVal,      aminet.author,
  632.                     STRINGA_MinVisible,   20,
  633.                     STRINGA_MaxChars,     40,
  634.                 TAG_END),
  635.                 LAYOUT_AddChild,          aminet_gadgets[GID_2_ST4] =
  636.                 NewObject
  637.                 (   STRING_GetClass(),    NULL,
  638.                     GA_ID,                GID_2_ST4,
  639.                     GA_TabCycle,          TRUE,
  640.                     STRINGA_TextVal,      aminet.version,
  641.                     STRINGA_MinVisible,   20,
  642.                     STRINGA_MaxChars,     40,
  643.                 TAG_END),
  644.                 LAYOUT_AddChild,          aminet_gadgets[GID_2_ST5] =
  645.                 NewObject
  646.                 (   STRING_GetClass(),    NULL,
  647.                     GA_ID,                GID_2_ST5,
  648.                     GA_TabCycle,          TRUE,
  649.                     STRINGA_TextVal,      aminet.replaces,
  650.                     STRINGA_MinVisible,   20,
  651.                     STRINGA_MaxChars,     40,
  652.                 TAG_END),
  653.                 LAYOUT_AddChild,          aminet_gadgets[GID_2_ST6] =
  654.                 NewObject
  655.                 (   STRING_GetClass(),    NULL,
  656.                     GA_ID,                GID_2_ST6,
  657.                     GA_TabCycle,          TRUE,
  658.                     STRINGA_TextVal,      aminet.requires,
  659.                     STRINGA_MinVisible,   20,
  660.                     STRINGA_MaxChars,     40,
  661.                 TAG_END),
  662.                 LAYOUT_AddChild,          aminet_gadgets[GID_2_ST7] =
  663.                 NewObject
  664.                 (   STRING_GetClass(),    NULL,
  665.                     GA_ID,                GID_2_ST7,
  666.                     GA_TabCycle,          TRUE,
  667.                     STRINGA_TextVal,      aminet.distribution,
  668.                     STRINGA_MinVisible,   20,
  669.                     STRINGA_MaxChars,     40,
  670.                 TAG_END),
  671.             TAG_END),
  672.         TAG_END),
  673.         CHILD_WeightedHeight,         0,
  674.         LAYOUT_AddChild,
  675.         NewObject
  676.         (   LAYOUT_GetClass(),        NULL,
  677.             LAYOUT_Orientation,       LAYOUT_ORIENT_HORIZ,
  678.             LAYOUT_SpaceOuter,        TRUE,
  679.             LAYOUT_HorizAlignment,    LALIGN_RIGHT,
  680.             LAYOUT_BevelStyle,        BVS_NONE,
  681.             LAYOUT_AddImage,
  682.             NewObject
  683.             (   LABEL_GetClass(),     NULL,
  684.                 LABEL_Text,           "_Long description:",
  685.                 LABEL_Justification,  LJ_CENTER,
  686.             TAG_END),
  687.         TAG_END),
  688.         CHILD_WeightedHeight,         0,
  689.         LAYOUT_AddChild,              aminet_gadgets[GID_2_TE1] =
  690.         NewObject
  691.         (   TEXTEDITOR_GetClass(),    NULL,
  692.             GA_ID,                    GID_2_TE1,
  693.             GA_TabCycle,              TRUE,
  694.             GA_RelVerify,             TRUE,
  695.             GA_TEXTEDITOR_ExportWrap, 75,
  696.         TAG_END),
  697.         CHILD_WeightedHeight,         50,
  698.         CHILD_MinHeight,              92,
  699.         LAYOUT_AddChild,
  700.         NewObject
  701.         (   LAYOUT_GetClass(),        NULL,
  702.             LAYOUT_Orientation,       LAYOUT_ORIENT_HORIZ,
  703.             LAYOUT_SpaceOuter,        TRUE,
  704.             LAYOUT_HorizAlignment,    LALIGN_RIGHT,
  705.             LAYOUT_BevelStyle,        BVS_NONE,
  706.             LAYOUT_AddImage,
  707.             NewObject
  708.             (   LABEL_GetClass(),     NULL,
  709.                 LABEL_Text,           "Directory:",
  710.                 LABEL_Justification,  LJ_CENTER,
  711.             TAG_END),
  712.             CHILD_WeightedWidth,      50,
  713.             LAYOUT_AddImage,
  714.             NewObject
  715.             (   LABEL_GetClass(),     NULL,
  716.                 LABEL_Text,           "Subdirectory:",
  717.                 LABEL_Justification,  LJ_CENTER,
  718.             TAG_END),
  719.             CHILD_WeightedWidth,      50,
  720.         TAG_END),
  721.         CHILD_WeightedHeight,         0,
  722.         LAYOUT_AddChild,
  723.         NewObject
  724.         (   LAYOUT_GetClass(),        NULL,
  725.             LAYOUT_Orientation,       LAYOUT_ORIENT_HORIZ,
  726.             LAYOUT_SpaceOuter,        TRUE,
  727.             LAYOUT_HorizAlignment,    LALIGN_CENTER,
  728.             LAYOUT_BevelStyle,        BVS_NONE,
  729.             LAYOUT_AddChild,          aminet_gadgets[GID_2_LB1] =
  730.             NewObject
  731.             (   LISTBROWSER_GetClass(),NULL,
  732.                 GA_ID,                 GID_2_LB1,
  733.                 GA_RelVerify,          TRUE,
  734.                 GA_TextAttr,           &Topaz8,
  735.                 LISTBROWSER_Labels,    (ULONG) &MainTypeList,
  736.                 LISTBROWSER_MinVisible,6,
  737.             TAG_END),
  738.             LAYOUT_AddChild,           aminet_gadgets[GID_2_LB2] =
  739.             NewObject
  740.             (   LISTBROWSER_GetClass(),NULL,
  741.                 GA_ID,                 GID_2_LB2,
  742.                 GA_RelVerify,          TRUE,
  743.                 GA_TextAttr,           &Topaz8,
  744.                 LISTBROWSER_Labels,    (ULONG) &EmptySubTypeList,
  745.                 LISTBROWSER_MinVisible,6,
  746.             TAG_END),
  747.         TAG_END),
  748.         CHILD_WeightedHeight,          50,
  749.     TAG_END),
  750. TAG_END)))
  751. {   rq("Can't create ReAction gadgets!");
  752. }
  753. unlockscreen();
  754. openwindow();
  755.  
  756.     SetGadgetAttrs
  757.     (   aminet_gadgets[GID_2_TE1],    MainWindowPtr, NULL,
  758.         GA_TEXTEDITOR_Contents, aminet.textfield
  759.     ); // long description
  760.     OnMenu(MainWindowPtr, FULLMENUNUM(MN_PROJECT, IN_NEW,    NOSUB));
  761.     OnMenu(MainWindowPtr, FULLMENUNUM(MN_PROJECT, IN_OPEN,   NOSUB));
  762.     OnMenu(MainWindowPtr, FULLMENUNUM(MN_PROJECT, IN_SAVE,   NOSUB));
  763.     OnMenu(MainWindowPtr, FULLMENUNUM(MN_PROJECT, IN_SAVEAS, NOSUB));
  764.  
  765.     updatesubtype();
  766.     ActivateLayoutGadget(aminet_gadgets[GID_2_LY1], MainWindowPtr, NULL, (Object) aminet_gadgets[GID_2_ST1]);
  767.     loop();
  768.     readaminetgadgets();
  769.     closewindow();
  770.     // now that the window is closed we can free lists
  771.     aminet_exit();
  772. }
  773.  
  774. AGLOBAL void saveaminet(ABOOL saveas)
  775. {   /*  Short:        <short>
  776.         Uploader:     <uploader>
  777.         Author:       <author>
  778.         Type:         <type>
  779.         Replaces:     <replaces>
  780.         Requires:     <requires>
  781.         Version:      <version>
  782.         Distribution: <distribution>
  783.         
  784.         <long description> */
  785.  
  786.     readaminetgadgets();
  787.  
  788.     strcpy(IOBuffer, "Short:        ");
  789.     strcat(IOBuffer, aminet.amishort);
  790.     strcat(IOBuffer, "\n");
  791.     if (aminet.uploader[0])
  792.     {    strcat(IOBuffer, "Uploader:     ");
  793.             strcat(IOBuffer, aminet.uploader);
  794.         strcat(IOBuffer, "\n");
  795.     }
  796.     if (aminet.author[0])
  797.     {   strcat(IOBuffer, "Author:       ");
  798.         strcat(IOBuffer, aminet.author);
  799.         strcat(IOBuffer, "\n");
  800.     }
  801.     // it's compulsory to select a type
  802.     strcat(IOBuffer, "Type:         ");
  803.     strcat(IOBuffer, aminet.type);
  804.     strcat(IOBuffer, "\n");
  805.     if (aminet.replaces[0])
  806.     {   strcat(IOBuffer, "Replaces:     ");
  807.         strcat(IOBuffer, aminet.replaces);
  808.         strcat(IOBuffer, "\n");
  809.     }
  810.     if (aminet.requires[0])
  811.     {   strcat(IOBuffer, "Requires:     ");
  812.         strcat(IOBuffer, aminet.requires);
  813.         strcat(IOBuffer, "\n");
  814.     }
  815.     if (aminet.version[0])
  816.     {   strcat(IOBuffer, "Version:      ");
  817.         strcat(IOBuffer, aminet.version);
  818.         strcat(IOBuffer, "\n");
  819.     }
  820.     if (aminet.distribution[0])
  821.     {   strcat(IOBuffer, "Distribution: ");
  822.         strcat(IOBuffer, aminet.distribution);
  823.         strcat(IOBuffer, "\n");
  824.     }
  825.     strcat(IOBuffer, "\n");
  826.     strcat(IOBuffer, aminet.textfield);
  827.  
  828.     if (!aminet.output[0] || saveas) // if we need a filename
  829.     {   if (saveasl("Save Aminet Readme", "#?.readme"))
  830.         {   strcpy(aminet.output, aslresult);
  831.             writeout(aminet.output);
  832.     }   }
  833.     writeout(aminet.output);
  834. }
  835.  
  836. AGLOBAL void aminet_exit(void)
  837. {   if (SubTypeNodes)
  838.     {   clearreactionlist(&SubTypeList);
  839.         SubTypeNodes = FALSE;
  840. }   }
  841.  
  842. AGLOBAL void aminet_loop(ULONG gid)
  843. {   ULONG code;
  844.  
  845.     switch(gid)
  846.     {
  847.     case GID_2_LB1:
  848.         /* code is the position within the list, starting from 0. */
  849.         if (!(GetAttr
  850.         (   LISTBROWSER_Selected, aminet_gadgets[GID_2_LB1], (ULONG *) &code
  851.         )))
  852.         {   rq("Unsupported inquiry!"); // should never happen
  853.         }
  854.         aminet.maintype = code;
  855.         aminet.subtype  = 0;
  856.         updatesubtype();
  857.     break;
  858.     case GID_2_LB2:
  859.         /* code is the position within the list, starting from 0. */
  860.         if (!(GetAttr
  861.         (   LISTBROWSER_Selected, aminet_gadgets[GID_2_LB2], (ULONG *) &code
  862.         )))
  863.         {   rq("Unsupported inquiry!"); // should never happen
  864.         }
  865.         aminet.subtype = code;
  866.     break;
  867.     default:
  868.     break;
  869. }   }
  870.  
  871. AGLOBAL void newaminet(ABOOL display)
  872. {   aminet.amishort[0]     =
  873.     aminet.uploader[0]     =
  874.     aminet.author[0]       =
  875.     aminet.requires[0]     =
  876.     aminet.distribution[0] =
  877.     aminet.type[0]         =
  878.     aminet.replaces[0]     =
  879.     aminet.output[0]       =
  880.     aminet.textfield[0]    =
  881.     aminet.maintype        =
  882.     aminet.subtype         = 0;
  883.     strcpy(aminet.version, "1.0");
  884.  
  885.     if (display)
  886.         updateaminetgadgets();
  887. }
  888.  
  889. AGLOBAL void openaminet(void)
  890. {   if (asl("#?.readme"))
  891.     {   loadaminet();
  892.         updateaminetgadgets();
  893. }   }
  894.  
  895. AGLOBAL void loadaminet(void)
  896. {   ABOOL done = FALSE;
  897.     ULONG i, j, slashpos = 0;
  898.     TEXT  tempstring[13];
  899.  
  900.     if (readin(aslresult))
  901.     {   strcpy(aminet.output, aslresult);
  902.         offset = 0;
  903.  
  904.         // Clear all fields.
  905.         aminet.amishort[0]     =
  906.         aminet.uploader[0]     =
  907.         aminet.author[0]       =
  908.         aminet.requires[0]     =
  909.         aminet.distribution[0] =
  910.         aminet.type[0]         =
  911.         aminet.replaces[0]     =
  912.         aminet.output[0]       =
  913.         aminet.textfield[0]    =
  914.         aminet.maintype        =
  915.         aminet.subtype         =
  916.         aminet.version[0]      = 0;
  917.  
  918.         do
  919.         {   parse("\n");
  920.             if (string[0] == 0 || (string[0] == CR && string[1] == 0)) // CR support is for IBM-PC compatibility
  921.             {   done = TRUE;
  922.                 parsetoend();
  923.                 strcpy(aminet.textfield, string);
  924.             } elif (!strncmp(string, "Short:",         6))
  925.             {   for (i =  6; i < strlen(string); i++)
  926.                 {   if (string[i] != ' ')
  927.                     {   strcpy(aminet.amishort,     &string[i]);
  928.                         break;
  929.             }   }   }
  930.             elif (!strncmp(string, "Uploader:",      9))
  931.             {   for (i =  9; i < strlen(string); i++)
  932.                 {   if (string[i] != ' ')
  933.                     {   strcpy(aminet.uploader,     &string[i]);
  934.                         break;
  935.             }   }   }
  936.             elif (!strncmp(string, "Author:",        7))
  937.             {   for (i =  7; i < strlen(string); i++)
  938.                 {   if (string[i] != ' ')
  939.                     {   strcpy(aminet.author,       &string[i]);
  940.                         break;
  941.             }   }   }
  942.             elif (!strncmp(string, "Type:",          5))
  943.             {   for (i =  5; i < strlen(string); i++)
  944.                 {   if (string[i] != ' ')
  945.                     {   // OK, we are now at the start of useful data
  946.                         strcpy(aminet.type, &string[i]);
  947.                         while (aminet.type[slashpos] != '/')
  948.                         {   slashpos++;
  949.                         }
  950.                         // slashpos is now offset of '/'
  951.                         strncpy(tempstring, aminet.type, slashpos);                        tempstring[slashpos] = 0;
  952.                         for (j = 0; j <= MAINTYPES; j++)
  953.                         {   if (!strcmp(tempstring, category[j].name))
  954.                             {   aminet.maintype = j; // set up aminet.maintype
  955.                                 break;
  956.                         }   }
  957.                         slashpos++; // move past '/'
  958.                         for (j = offsets[aminet.maintype].start; j <= offsets[aminet.maintype].end; j++)
  959.                         {   if (!strcmp(&aminet.type[slashpos], category[j].name))
  960.                             {   aminet.subtype = j - offsets[aminet.maintype].start;
  961.                                 break;
  962.                         }   }
  963.                         break;
  964.             }   }   }
  965.             elif (!strncmp(string, "Replaces:",      9))
  966.             {   for (i =  9; i < strlen(string); i++)
  967.                 {   if (string[i] != ' ')
  968.                     {   strcpy(aminet.replaces,     &string[i]);
  969.                         break;
  970.             }   }   }
  971.             elif (!strncmp(string, "Requires:",      9))
  972.             {   for (i =  9; i < strlen(string); i++)
  973.                 {   if (string[i] != ' ')
  974.                     {   strcpy(aminet.requires,     &string[i]);
  975.                         break;
  976.             }   }   }
  977.             elif (!strncmp(string, "Version:",       8))
  978.             {   for (i =  8; i < strlen(string); i++)
  979.                 {   if (string[i] != ' ')
  980.                     {   strcpy(aminet.version,      &string[i]);
  981.                         break;
  982.             }   }   }
  983.             elif (!strncmp(string, "Distribution:", 13))
  984.             {   for (i = 13; i < strlen(string); i++)
  985.                 {   if (string[i] != ' ')
  986.                     {   strcpy(aminet.distribution, &string[i]);
  987.                         break;
  988.         }   }   }   }
  989.         while (!done);
  990. }   }
  991.  
  992. MODULE void updateaminetgadgets(void)
  993. {   SetGadgetAttrs
  994.     (   aminet_gadgets[GID_2_ST1], MainWindowPtr, NULL,
  995.         GTST_String, aminet.amishort,
  996.         TAG_END
  997.     );
  998.     SetGadgetAttrs
  999.     (   aminet_gadgets[GID_2_ST2], MainWindowPtr, NULL,
  1000.         GTST_String, aminet.uploader,
  1001.         TAG_END
  1002.     );
  1003.     SetGadgetAttrs
  1004.     (   aminet_gadgets[GID_2_ST3], MainWindowPtr, NULL,
  1005.         GTST_String, aminet.author,
  1006.         TAG_END
  1007.     );
  1008.     SetGadgetAttrs
  1009.     (   aminet_gadgets[GID_2_ST4], MainWindowPtr, NULL,
  1010.         GTST_String, aminet.version,
  1011.         TAG_END
  1012.     );
  1013.     SetGadgetAttrs
  1014.     (   aminet_gadgets[GID_2_ST5], MainWindowPtr, NULL,
  1015.         GTST_String, aminet.replaces,
  1016.         TAG_END
  1017.     );
  1018.     SetGadgetAttrs
  1019.     (   aminet_gadgets[GID_2_ST6], MainWindowPtr, NULL,
  1020.         GTST_String, aminet.requires,
  1021.         TAG_END
  1022.     );
  1023.     SetGadgetAttrs
  1024.     (   aminet_gadgets[GID_2_ST7], MainWindowPtr, NULL,
  1025.         GTST_String, aminet.distribution,
  1026.         TAG_END
  1027.     );
  1028.     SetGadgetAttrs // `Type'
  1029.     (   aminet_gadgets[GID_2_LB1],
  1030.         MainWindowPtr, NULL,
  1031.         LISTBROWSER_Selected, aminet.maintype,
  1032.         TAG_END
  1033.     );
  1034.  
  1035.     updatesubtype();
  1036.  
  1037.     SetGadgetAttrs
  1038.     (   aminet_gadgets[GID_2_TE1], MainWindowPtr, NULL,
  1039.         GA_TEXTEDITOR_Contents, aminet.textfield,
  1040.         TAG_DONE
  1041.     );
  1042.     // It would be polite to scroll the listviews so that the selected
  1043.     // entries are visible.
  1044. }
  1045. MODULE void readaminetgadgets(void)
  1046. {   STRPTR stringptr;
  1047.  
  1048.     if (!(GetAttr
  1049.     (   STRINGA_TextVal, aminet_gadgets[GID_2_ST1], (ULONG *) &stringptr
  1050.     )))
  1051.     {   rq("Unsupported inquiry!"); // should never happen
  1052.     }
  1053.     strcpy(aminet.amishort, stringptr);
  1054.  
  1055.     if (!(GetAttr
  1056.     (   STRINGA_TextVal, aminet_gadgets[GID_2_ST2], (ULONG *) &stringptr
  1057.     )))
  1058.     {   rq("Unsupported inquiry!"); // should never happen
  1059.     }
  1060.     strcpy(aminet.uploader, stringptr);
  1061.  
  1062.     if (!(GetAttr
  1063.     (   STRINGA_TextVal, aminet_gadgets[GID_2_ST3], (ULONG *) &stringptr
  1064.     )))
  1065.     {   rq("Unsupported inquiry!"); // should never happen
  1066.     }
  1067.     strcpy(aminet.author, stringptr);
  1068.  
  1069.     if (!(GetAttr
  1070.     (   STRINGA_TextVal, aminet_gadgets[GID_2_ST4], (ULONG *) &stringptr
  1071.     )))
  1072.     {   rq("Unsupported inquiry!"); // should never happen
  1073.     }
  1074.     strcpy(aminet.replaces, stringptr);
  1075.  
  1076.     if (!(GetAttr
  1077.     (   STRINGA_TextVal, aminet_gadgets[GID_2_ST5], (ULONG *) &stringptr
  1078.     )))
  1079.     {   rq("Unsupported inquiry!"); // should never happen
  1080.     }
  1081.     strcpy(aminet.requires, stringptr);
  1082.  
  1083.     if (!(GetAttr
  1084.     (   STRINGA_TextVal, aminet_gadgets[GID_2_ST6], (ULONG *) &stringptr
  1085.     )))
  1086.     {   rq("Unsupported inquiry!"); // should never happen
  1087.     }
  1088.     strcpy(aminet.version, stringptr);
  1089.  
  1090.     if (!(GetAttr
  1091.     (   STRINGA_TextVal, aminet_gadgets[GID_2_ST7], (ULONG *) &stringptr
  1092.     )))
  1093.     {   rq("Unsupported inquiry!"); // should never happen
  1094.     }
  1095.     strcpy(aminet.distribution, stringptr);
  1096.  
  1097.     strcpy(aminet.type, category[aminet.maintype].name);
  1098.     strcat(aminet.type, "/");
  1099.     strcat(aminet.type, category[offsets[aminet.maintype].start + aminet.subtype].name);
  1100.  
  1101.     stringptr = (STRPTR) DoGadgetMethod
  1102.     (   aminet_gadgets[GID_2_TE1], MainWindowPtr, NULL,
  1103.         GM_TEXTEDITOR_ExportText, NULL
  1104.     );
  1105.     strcpy(aminet.textfield, stringptr); // long description
  1106.     FreeVec((APTR) stringptr);
  1107.     // textBuffer = NULL;
  1108. }
  1109.  
  1110. AGLOBAL void aminet_init(void)
  1111. {   ULONG        i, j, length;
  1112.     struct Node* ListBrowserNodePtr;
  1113.  
  1114.     NewList(&SubTypeList);
  1115.     NewList(&EmptySubTypeList);
  1116.  
  1117.     NewList(&MainTypeList);
  1118.     for (i = 0; i <= MAINTYPES; i++)
  1119.     {   strcpy(string, category[i].name);
  1120.         length = 5 - strlen(category[i].name);
  1121.         for (j = 1; j <= length; j++)
  1122.             strcat(string, " ");
  1123.         strcat(string, category[i].desc);
  1124.  
  1125.         if (!(ListBrowserNodePtr = AllocListBrowserNode
  1126.         (    1,              // columns,
  1127.              LBNA_Column,    0,
  1128.              LBNCA_CopyText, TRUE,
  1129.              LBNCA_Text,     string,
  1130.              TAG_END
  1131.         )))
  1132.         {   rq("Can't create ReAction listbrowser.gadget node(s)!");
  1133.         }
  1134.         AddTail(&MainTypeList, ListBrowserNodePtr); // AddTail() has no return code
  1135.         MainTypeNodes = TRUE;
  1136. }   }
  1137.  
  1138. AGLOBAL void aminet_die(void)
  1139. {   if (MainTypeNodes)
  1140.     {   clearreactionlist(&MainTypeList);
  1141.         MainTypeNodes = FALSE;
  1142. }   }
  1143.  
  1144. MODULE void updatesubtype(void)
  1145. {   ULONG        i, j, temp;
  1146.     struct Node* ListBrowserNodePtr;
  1147.      
  1148.     SetGadgetAttrs // `Subtype'
  1149.     (   aminet_gadgets[GID_2_LB2],
  1150.         MainWindowPtr, NULL,
  1151.         LISTBROWSER_Labels, NULL, // detach it
  1152.         TAG_END
  1153.     );
  1154.  
  1155.     if (SubTypeNodes)
  1156.     {   clearreactionlist(&SubTypeList);
  1157.     }
  1158.  
  1159.     SubTypeNodes = TRUE;
  1160.     for
  1161.     (   i = offsets[aminet.maintype].start;
  1162.         i <= offsets[aminet.maintype].end;
  1163.         i++
  1164.     )
  1165.     {   strcpy(string, category[i].name);
  1166.         temp = 6 - strlen(category[i].name);
  1167.         for (j = 1; j <= temp; j++)
  1168.             strcat(string, " ");
  1169.         strcat(string, category[i].desc);
  1170.  
  1171.         if (!(ListBrowserNodePtr = AllocListBrowserNode
  1172.         (    1,                   // columns,
  1173.              LBNCA_CopyText,      TRUE,
  1174.              LBNCA_Text,          string,
  1175.              TAG_END
  1176.         )))
  1177.         {   rq("Can't create ReAction listbrowser.gadget node(s)!");
  1178.         }
  1179.         AddTail(&SubTypeList, ListBrowserNodePtr); // AddTail() has no return code
  1180.     }
  1181.  
  1182.     SetGadgetAttrs // `Subtype'
  1183.     (   aminet_gadgets[GID_2_LB2],
  1184.         MainWindowPtr, NULL,
  1185.         LISTBROWSER_Labels, &SubTypeList,
  1186.         LISTBROWSER_Selected, aminet.subtype,
  1187.         TAG_END
  1188.     );
  1189. }
  1190.  
  1191. AGLOBAL ULONG Hook2Func(struct Hook *h, VOID *o, VOID *msg)
  1192. {   /* "When the hook is called, the data argument points to the 
  1193.     window object and message argument to the IntuiMessage." */
  1194.  
  1195.     UWORD code, qual;
  1196.     ULONG scroll = 0;
  1197.  
  1198.     geta4(); // wait till here before doing anything
  1199.  
  1200.     code = ((struct IntuiMessage *) msg)->Code;
  1201.     qual = ((struct IntuiMessage *) msg)->Qualifier;
  1202.  
  1203.     switch(code)
  1204.     {
  1205.     case SCAN_HELP:
  1206.         helpabout();
  1207.     break;
  1208.     case SCAN_ESCAPE:
  1209.         if ((qual & IEQUALIFIER_LSHIFT) || (qual & IEQUALIFIER_RSHIFT))
  1210.         {   cleanexit(EXIT_SUCCESS);
  1211.         } else page = 0;
  1212.     break;
  1213.     case SCAN_UP:
  1214.         if (qual & IEQUALIFIER_CONTROL)
  1215.         {   scroll = LBP_TOP;
  1216.         } elif (qual & IEQUALIFIER_LSHIFT || qual & IEQUALIFIER_RSHIFT)
  1217.         {   scroll = LBP_PAGEUP;
  1218.         } else scroll = LBP_LINEUP;
  1219.     break;
  1220.     case SCAN_DOWN:
  1221.         if (qual & IEQUALIFIER_CONTROL)
  1222.         {   scroll = LBP_BOTTOM;
  1223.         } elif (qual & IEQUALIFIER_LSHIFT || qual & IEQUALIFIER_RSHIFT)
  1224.         {   scroll = LBP_PAGEDOWN;
  1225.         } else scroll = LBP_LINEDOWN;
  1226.     break;
  1227.     case SCAN_S:
  1228.         ActivateLayoutGadget(aminet_gadgets[GID_2_LY1], MainWindowPtr, NULL, (Object) aminet_gadgets[GID_2_ST1]);
  1229.     break;
  1230.     case SCAN_U:
  1231.         ActivateLayoutGadget(aminet_gadgets[GID_2_LY1], MainWindowPtr, NULL, (Object) aminet_gadgets[GID_2_ST2]);
  1232.     break;
  1233.     case SCAN_A:
  1234.         ActivateLayoutGadget(aminet_gadgets[GID_2_LY1], MainWindowPtr, NULL, (Object) aminet_gadgets[GID_2_ST3]);
  1235.     break;
  1236.     case SCAN_R:
  1237.         ActivateLayoutGadget(aminet_gadgets[GID_2_LY1], MainWindowPtr, NULL, (Object) aminet_gadgets[GID_2_ST4]);
  1238.     break;
  1239.     case SCAN_E:
  1240.         ActivateLayoutGadget(aminet_gadgets[GID_2_LY1], MainWindowPtr, NULL, (Object) aminet_gadgets[GID_2_ST5]);
  1241.     break;
  1242.     case SCAN_V:
  1243.         ActivateLayoutGadget(aminet_gadgets[GID_2_LY1], MainWindowPtr, NULL, (Object) aminet_gadgets[GID_2_ST6]);
  1244.     break;
  1245.     case SCAN_D:
  1246.         ActivateLayoutGadget(aminet_gadgets[GID_2_LY1], MainWindowPtr, NULL, (Object) aminet_gadgets[GID_2_ST7]);
  1247.     break;
  1248.     case SCAN_L:
  1249.         ActivateLayoutGadget(aminet_gadgets[GID_2_LY1], MainWindowPtr, NULL, (Object) aminet_gadgets[GID_2_TE1]);
  1250.     break;
  1251.     default:
  1252.     break;
  1253.     }
  1254.  
  1255.     if (code == SCAN_UP || code == SCAN_DOWN)
  1256.     {   SetGadgetAttrs
  1257.         (   aminet_gadgets[GID_2_LB2],    // pointer to gadget
  1258.             MainWindowPtr,                // pointer to window (not window object!)
  1259.             NULL,                         // pointer to requester
  1260.             LISTBROWSER_Position, scroll, // tags
  1261.             TAG_DONE                      // done
  1262.         );
  1263.     }
  1264.  
  1265.     return(1);
  1266. }
  1267.  
  1268.